'use strict';
let Response = require('../../../model/Response');
let RestifyProxy = require('../../../util/RestifyProxy');
let CustomPageBean = require('../../../model/CustomPageBean');
let logMessageService = require('../../../service/Report/logMessageService');
let logger = require('../../../util/LoggerUtil').logger('logMessageController.js');

/**
 * 报文日志页面
 */

module.exports.logMessagePage = function () {
    let response = new Response();
    response.render('back/report/log-message/log-message');
    this.resolve(response);
};
/**
 * 报文日志列表
 */
module.exports.logMessageList = async function () {
    let req = this.req;
    let params = req.body;
    let response = new Response();
    try {
        let result = await logMessageService.logMessageList(this, params);
        let pageBean = new CustomPageBean(result);
        response.send(pageBean);
    } catch (error) {
        logger.error(error);
    }
    this.resolve(response);
};

/**
 * 报文日志Excel导出
 */
module.exports.logMessageExport = async function () {
    let req = this.req;
    let params = req.body;
    let response = new Response();
    try {
        let result = await logMessageService.getLogMessageExport(this, params);
        response.send(result);
    } catch (error) {
        logger.error(error);
    }
    this.resolve(response);
};

